package apiday03.homework;

import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;

public class SoreString {
    public static void main(String[] args) {
        List<String> list = new LinkedList<>();
        list.add("tom");
        list.add("jerry");
        list.add("sam");
        list.add("Duck");
        list.add("jack");
        System.out.println(list);
        Collections.sort(list);
        System.out.println(list);
        Collections.reverse(list);
        System.out.println(list);
        System.out.println("----------------------------");

        List<String> list1 = new LinkedList<>();
        list1.add("请问啊在");
        list1.add("请知悉");
        list1.add("爱看");
        list1.add("大大欧文啊下");
        System.out.println(list1);
        Collections.sort(list1,(o1, o2) -> o1.length()-o2.length());
        System.out.println(list1);
        Collections.reverse(list1);
        System.out.println(list1);

    }
}
